﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SacNetUG.Master" Inherits="System.Web.Mvc.ViewPage<PaginatedList<SacNetUG.Models.Event>>" %>
<%@ Import Namespace="SacNetUG.Models"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Events
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $(".adminLink").click(function (event) {
            event.preventDefault();
            $(".adminView").show();
        });

        $(".deleteLink").click(function () {
            $.post(this.href);
            $(this).parent().parent().remove();
            return false;
        });
    });
</script>

    <h2>Upcoming Events</h2>
    <hr />
    <% foreach (var item in Model) { %>
        
    <div class="floatRight"><span class="bold">Event Sponsor(s)</span>
    <br />
        <%= Html.InlineSponsorImage(item) %>               
    </div>
               
    <p>

        <span class="bold"><%= Html.Encode(item.StartDate.ToShortDateString() + " 6:00 PM") %></span>    
        <br />
        <%= Html.SpeakerLine(item) %>
        <br />
        <span class="bold">Topic: </span> <%= Html.Encode(item.Name) %>
        <br />
        <br />
        <span class="bold">Description:</span>        
    </p>
    <p class="eventInfo">

        <%= item.Description %>
    </p>
    <p>
        <span class="bold">Speaker Profile:</span>
    </p>
        <% foreach (var presenter in item.EventPresenters) { %>
    <div class="imgLeft">
        <%if (!string.IsNullOrEmpty(presenter.User.ImageUrl))
        {%>
         <%=Html.Image(presenter.User.ImageUrl, presenter.User.Name)%>  
        <%
        }%>
    </div>

    <div class="teamContent">
            <%= presenter.User.Bio %>


    </div>
    <div class="blockClear"></div>
        
        <% } %>

        <%= Html.ActionLink("Edit","Edit","Event",new {id = item.EventId}, new {@class = "adminView"}) %>
        <%--<%= Html.ActionLink("Delete", "Delete", "Team", new { id = item.EventId }, new { @class = "adminView deleteLink" })%>--%>
    
 <%--   
        <tr>
            <td>
                <%= Html.ActionLink("Edit", MVC.Event.Edit(item.EventId)) %>
            </td>
            <td>
                <%= Html.Encode(item.EventId) %>
            </td>
            <td>
                <%= Html.Encode(item.Name) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.Date)) %>
            </td>
            <td>
                <%= Html.Encode(item.LocationId) %>
            </td>
            <td>
                <%= item.Description %>
            </td>
        </tr>--%>
        <hr />
    <% } %>


    <p>
 
    <% if (Model.HasNextPage) {  %>
 
     <%= Html.ActionLink("Previous", "Index", new { id = (Model.PageIndex+1) }) %>

<% }
 
     if (Model.HasPreviousPage) { %>
 
    <%= Html.ActionLink("Next", "Index", new { id = (Model.PageIndex-1) }) %>

    <% } %>
<%--        <%= Html.ActionLink("Create New", "Create") %>--%>
    </p>

    <% if ((Boolean)ViewData["RenderAdminLink"]) %>
    <% { %>
        <p>
            <a href="" class="adminLink">Admin view</a>
            <br />
            <%=Html.ActionLink("Create", "Create", "Event", null, new {@class = "adminView"})%>
        </p>
    <% } %>

</asp:Content>

